From 4c0b239c1f373dfde5c4d1083c1ff5271eadce12 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 20 Feb 2018 19:30:00 -0800 Subject: [PATCH] Expose git errors during authentication. --- src/cargo/sources/git/utils.rs | 4 ++-- tests/testsuite/build_auth.rs | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cargo/sources/git/utils.rs b/src/cargo/sources/git/utils.rs index 640138525..6fe8fad74 100644 --- a/src/cargo/sources/git/utils.rs +++ b/src/cargo/sources/git/utils.rs @@ -12,7 +12,7 @@ use url::Url; use core::GitReference; use util::{ToUrl, internal, Config, network, Progress}; -use util::errors::{CargoResult, CargoResultExt, Internal}; +use util::errors::{CargoResult, CargoResultExt, CargoError}; #[derive(PartialEq, Clone, Debug)] pub struct GitRevision(git2::Oid); @@ -546,7 +546,7 @@ fn with_authentication(url: &str, cfg: &git2::Config, mut f: F) // In the case of an authentication failure (where we tried something) then // we try to give a more helpful error message about precisely what we // tried. - let res = res.map_err(Internal::new).chain_err(|| { + let res = res.map_err(CargoError::from).chain_err(|| { let mut msg = "failed to authenticate when downloading \ repository".to_string(); if !ssh_agent_attempts.is_empty() { diff --git a/tests/testsuite/build_auth.rs b/tests/testsuite/build_auth.rs index 53ec0d4f1..66b978eb4 100644 --- a/tests/testsuite/build_auth.rs +++ b/tests/testsuite/build_auth.rs @@ -118,7 +118,9 @@ Caused by: failed to authenticate when downloading repository attempted to find username/password via `credential.helper`, but [..] -To learn more, run the command again with --verbose. +Caused by: + curl error: Failed to connect to 127.0.0.1 port [..]: Connection refused +; class=Net (12) ", addr = addr))); -- 2.30.2